package com.xing.algorithm.array;

public class SingleNumber {

    public static int singleNumber(int[] nums) {
        if(nums.length == 0) {
            return -1;
        }

        int result = 0;
        for(int i = 0; i < nums.length; i ++) {
            result = result ^ nums[i];
        }

        return result;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1,2,2};
        System.out.println(singleNumber(nums));
    }
}
